<script setup lang="ts">
import {router} from "@/router";
import {cementPage} from "@/pages/management/mangementApi.js";
import {openCement} from "@/pages/welcome/welcomeApi.js";
const cement = ref([])
const getCementData = async () => {
  await cementPage({pageSize: 7, pageNum: 1}).then(res => {
    cement.value= res.data.records
  })
}


const toInformation = () => {
  router.push('/information')
}



onMounted(() => {
  getCementData();
})
</script>

<template>
  <el-card :body-style="{ padding: '0px' }" style="width: 100%">
    <template #header>
      <div class="card-header">
        <span>公告</span>
        <el-button type="primary" text @click="toInformation">全部公告</el-button>
      </div>
    </template>
    <el-row style="width: 100%;margin-top: 2.5px;margin-bottom: 2.5px">
      <el-col class="el-col" v-for="(item, index) in cement" :key="index">
        <el-card @click="openCement(item)" :body-style="{ padding: '3px' }" shadow="hover">
          <div style="display: flex;">
            <el-avatar class="avatar" shape="square" :src="item.imgUrl"/>
            <div style="margin-left: 10px">
              <span style="font-size: 15px">{{ item.title }}</span>
              <p style="font-size: 13px;color: #6b7280">{{ item.content }}</p>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </el-card>
</template>

<style scoped lang="scss">
.el-button:hover {
  background: none !important; // 移除背景颜色
  border-color: initial !important; // 移除边框颜色
  box-shadow: none !important; // 移除阴影效果
}

.card-header {
  display: flex;
  height: 15px;
  justify-content: space-between;
}
.avatar{
  width: 180px;
  height: 60px;
}
.el-col {
  padding: 2.5px;
}
</style>
